<?

function hello(){
	echo "<br/>Hello World!<br/>";
}

function br(){
	echo "<br/>";
}

function show($value){
	include_once($_SERVER['DOCUMENT_ROOT']."/lucy/config.php");
	$_SESSION['print']['echo'] = $value;
	$mod_name = "print";
	$send = "<meta http-equiv='refresh' content=\"0;url=http://localhost/lucy/sys/mod/".$mod_name.".php?inSess=".session_id()."\">";
	echo $send;
}


function is_feeling($str){
	$is_feeling = array("jūtos", "jutos", "jūtas", "sajūta", "sajūtas");
	foreach($is_feeling AS $name){
		if(strstr($str, $name)){
			return 1;
		}
	}
	return 0;
}

function is_word($word){
	if(!$dbcon){include(INC.'dbcon.php');}
	$sql = "SELECT `id` FROM `speech` WHERE `word` = '$word' AND `response` = '0'";
	$rez = mysql_query($sql, $dbcon);
	return (mysql_num_rows($rez)) ? 1 : 0;
}

function translate_feeling($feeling_num){
	$feeling[1][] = "pavisam slikti";
	$feeling[1][] = "draņķīgi";
	
	$feeling[2][] = "ne īpaši labi";
	$feeling[2][] = "nu tā, so-so";
	
	$feeling[3][] = "labi";
	$feeling[3][] = "normāli";
	$feeling[3][] = "ok";
	
	$feeling[4][] = "pozitīvi";
	$feeling[4][] = "patīkami labi";
	
	$feeling[5][] = "lieliski";
	$feeling[5][] = "ideāli";
	$feeling[5][] = "super";
	
	return $feeling[$feeling_num][array_rand($feeling[$feeling_num])];
}

function get_all_types(){
	if(!$dbcon){include(INC.'dbcon.php');}
	$sql = "SELECT DISTINCT `type` FROM `speech` ORDER BY `type`";
	$rez = mysql_query($sql, $dbcon);
	while($row = mysql_fetch_assoc($rez)){
		$type[] = $row['type'];
	}
	return $type;
}
?>